﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>条码出入库记录</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link href="~/X-admin/css/font.css" rel="stylesheet" />
    <script src="~/js/layui/layui.js"></script>
    <link href="~/X-admin/css/xadmin.css" rel="stylesheet" />
    <script src="~/X-admin/js/jquery.min.js"></script>
    <script src="~/X-admin/js/xadmin.js"></script>
    <script src="~/js/framework/sysframework.js"></script>
    <script src="~/js/framework/commonjs.js"></script>
</head>
<body>
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <form class="layui-form layui-col-space5" name="qForm" id="qForm">

                        <input type="hidden" name="barCode" id="barCode" />
                        @* <input type="hidden" name="proCode" id="proCode" />
                        <input type="hidden" name="spec" id="spec" />
                        <input type="hidden" name="c_tssx" id="c_tssx" />
                        <input type="hidden" name="inOutType" id="inOutType" /> *@
                    </form>
                    <div class="layui-table-body" id="layui-table-main">
                        <table class="layui-hide" id="list" lay-filter="list"></table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>

</html>

<script>
    var bars = "";
    function loadData() {
        layui.use('table', function () {
            var json = FormToJson("qForm");
            if (conditionJson != "false" && conditionJson != "") {
                var conJson = JSON.parse(conditionJson);
                json = Object.assign(conJson, json);
            }
            var conditon = encodeURIComponent(JSON.stringify(json));

            var table = layui.table;
            table.render({
                elem: '#list'
                , cols: [[ //标题栏
                    { type: 'checkbox' }
                    , { field: 'id', title: 'ID', width: 80 }
                    , { field: 'barCode', title: '条码', width: 130 }
                    , { field: 'proCode', title: '存货编码', width: 110, }
                    , { field: 'proName', title: '存货名称', width: 150 }
                    , { field: 'waterWashCode', title: '水洗标号', width: 150 }
                    , { field: 'number', title: '数量', width: 130 }
                    , { field: 'color', title: '颜色', width: 90, }
                    , { field: 'trademark', title: '商标', width: 100 }
                    , { field: 'customerName', title: '客户名称', width: 100 }
                    , { field: 'createuser', title: '装箱人员', width: 120 }
                    , { field: 'createtime', title: '装箱时间', width: 150 }
                ]], done: function (res, curr, count) {
                    $("[data-field='id']").css('display', 'none');//隐藏列
                    //循环表数据根据flag状态给行上色
                    // $.each(res['data'], function (i, j) {
                    //     if (j['isBack'] != "") {
                    //         TableRowColor('layui-table-main', i, '#AFEEEE');
                    //     }
                    // });
                }

                , url: "../Bar/GetDataList?dataType=barList&condition=" + conditon
                , skin: 'row' //表格风格
                , even: true
                , page: false //是否显示分页
                , limits: [10, 15, 20]
                , limit: 10 //每页默认显示的数量
            });

            table.on('checkbox(list)', function (obj) {
                var data = obj.data;
                //为父窗口input赋值
                bars = "";
                var checkStatus = table.checkStatus('list');
                var codes = "";
                for (var i = 0; i < checkStatus.data.length; i++) {
                    if (checkStatus.data[i].isBack == "") {
                        codes += checkStatus.data[i].barCode + ",";
                    }
                }
                bars = codes.substr(0, codes.length - 1);
            });

        });

    }
    var conditionJson = "";
    $(function () {

        //loadData();

        var dataId = getUrlVariable("barCode");

        if (dataId != "false" && dataId != "") {
            $("input[ name='barCode']").val(dataId);
        }
        loadData();
    })
</script>